/* using the built in sizeof() funtion to find the size of the basic
variable types in bytes. Then I will do some math to find how many
values can be held in each of the major types(remember that some can be
1/2 positive, 1/2 negative)*/
#include <stdio.h>
long byteconverter(int);
/* this is a function protocol. It declares the new function and allows your code to see it, without you having to declare it right here */
int main(void)
{
/* declaring variables */
int charsize=0, shortsize=0, intsize=0,longsize=0,unsignedsize=0;
/* doing math with the returned value of sizeof to give basic size(in bytes) and convert it using byteconverter()-I declared it at the top of the code,and define it at the bottom. Byteconverter takes the number of bytes, and returns the decimal number. */
charsize= byteconverter(sizeof(char));
shortsize=byteconverter( sizeof(short));
intsize= byteconverter(sizeof(int));
shortsize=byteconverter( sizeof(short));
intsize= byteconverter(sizeof(int));
longsize= byteconverter( sizeof(long));
unsignedsize=byteconverter(sizeof(unsigned));
printf("\nThe size of some of the types are given to you\n");
printf("How many values a char can hold:%d\n", charsize);
printf("How many values a short can hold:%d\n", shortsize);
printf("How many values a int can hold:%d \n", intsize);
printf("How many values a long can hold:%d\n", longsize);
printf("How many values a unsigned can hold:%d\n", unsignedsize);